<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AddFinanceRequest extends BaseFormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'xmid'=>'required|exists:project_lx,id',//项目id
            'finance'=>'required|array',//财务数据
            'file_list'=>'sometimes|nullable|array',//附件
            'desc'=>'sometimes|string|nullable',//备注
            'type'=>'required|numeric|in:1,2,3,4,5,6,7,9,8',
            'is_save'=>'required|in:0,1',
            'cwid'=>'required|numeric',//财务Id
            'batch_id'=>'required|string',//流水号
        ];
    }

    public function messages()
    {
        return [
            "xmid.required"=>'请选择项目',
            "finance.required"=>'财务数据不能为空',
            "type.required"=>'财务类型不能为空',
            "cwid.required"=>'财务ID不能为空',
            "batch_id.required"=>'流水号不能为空',
        ];
    }
}
